package yawning.mew.gui.tools;

import yawning.mew.character.Clazz;
import yawning.mew.character.Race;
import yawning.mew.character.Toon;

/**
 * Generic class that manages the toon data.
 * 	This class will contains the necessary functions to obtains abilities,
 * ratings and probabilites related to a character.
 * @author Ceridan
 *
 */
public class ToonWrapper {
	Toon toon;
	String name;
	String region;
	String server;
	
	/**
	 * Constructor.
	 * @param toon
	 * 	Toon object containing the character data.
	 * @param name
	 * 	Name of the character
	 * @param region
	 * 	Region of the character (US,CH,EU, etc...)
	 * @param server
	 * 	Server of the character.
	 */
	protected ToonWrapper(Toon toon, String name, String region, String server){
		this.toon = toon;
		this.name = name;
		this.region = region;
		this.server = server;
	}
	
	public ToonWrapper(String name, String region, String server)
	{
		toon = new Toon();
		this.name=name;
		this.region=region;
		this.server=server;
	}
	public ToonWrapper()
	{
		toon = new Toon();
		name="LocalPlayer";
		region="Unknown";
		server="none";
	}
	
	public Toon getToon(){return toon;}
	
	///GENERAL
	public int getAbility_Strength(){return toon.strength;}
	public void setAbility_Strength(int value){toon.strength = value;}
	public int getAbility_Agility(){return toon.agility;}
	public void setAbility_Agility(int value){toon.agility = value;}
	public int getAbility_Stamina(){return toon.stamina;}
	public void setAbility_Stamina(int value){toon.stamina = value;}
	public int getAbility_Intellect(){return toon.intellect;}
	public void setAbility_Intellect(int value){toon.intellect = value;}
	public int getAbility_Spirit(){return toon.spirit;}
	public void setAbility_Spirit(int value){toon.spirit = value;}
	
	///CHARACTER
	public String getChar_Region(){return region;}
	public String getChar_Name(){return name;}
	public String getChar_Server(){return server;}
	public Clazz getChar_Class(){return toon.mClass;}
	public void setChar_Class(Clazz toonClass){toon.mClass=toonClass;}
	public Race getChar_Race(){return toon.mRace;}
	public void setChar_Race(Race race){toon.mRace = race;}
	public int getChar_Level(){return toon.level;}
	public void setChar_Level(int level){toon.level = level;}
	public int getArmor(){return toon.armor;}
	
	///DAMAGE
	public int getDMG_WeaponDamageTop(){return toon.weaponTop;}
	public void getDMG_WeaponDamageTop(int value){toon.weaponTop = value;}
	public int getDMG_WeaponDamageBottom(){return toon.weaponBottom;}
	public void getDMG_WeaponDamageBottom(int value){toon.weaponBottom = value;}
	public int getDMG_WeaponDamageSpeed(){return toon.weaponSpeed;}
	public void getDMG_WeaponDamageSpeed(int value){toon.weaponSpeed = value;}
	
	///RATINGS
	public int getRating_Crit(){return toon.critRating;}
	public void setRating_Crit(int value){toon.critRating = value;}
	public int getRating_Hit(){return toon.hitRating;}
	public void setRating_Hit(int value){toon.hitRating = value;}
	public int getRating_Haste(){return toon.hasteRating;}
	public void setRating_Haste(int value){toon.hasteRating = value;}
	public int getRating_Dodge(){return toon.mDodgeRating;}
	public void setRating_Dodge(int value){toon.mDodgeRating = value;}
	public int getRating_Parry(){return toon.mParryRating;}
	public void setRating_Parry(int value){toon.mParryRating = value;}
	public int getRating_Block(){return toon.mBlockRating;}
	public void setRating_Block(int value){toon.mBlockRating = value;}
	public int getRating_Mastery(){return toon.masteryRating;}
	public void setRating_Mastery(int value){toon.masteryRating = value;}
	public int getRating_Expertise(){return toon.expertiseRating;}
	public void setRating_Expertise(int value){toon.expertiseRating = value;}
	public int getRating_AttackPower(){return toon.attackPower;}
	public void setRating_AttackPower(int value){toon.attackPower = value;}
	public int getRating_Resilience(){return toon.mResilienceRating;}
	public void setRating_Resilience(int value){toon.mResilienceRating = value;}
	public int getRating_SpellPower()
	{
		//TODO Implement Spellpower
		return 0;
	}
	
	/**
	 * Function that returns the revelent attribute groupings
	 * 
	 * @return
	 * 		A boolean array of size 4.
	 * 		The values are the following:
	 * 		index 0: Melee;
	 * 		index 1: Ranged;
	 * 		index 2: Magic;
	 * 		index 3: Defense;
	 * 
	 * Typically, classes that only have melee attacks wont see Magic and Ranged, non-tank classes wont see defenses,
	 * caster classes will not see Melee. Eventually this function will also counsider specs.
	 */
	public boolean[] getRevelentAttributes()
	{
		switch(toon.mClass)
		{
		case DEATH_KNIGHT:
			return new boolean[]{true,false,false,true};
		case DRUID:
			return new boolean[]{true,false,true,true};
		case HUNTER:
			return new boolean[]{true,true,true,false};
		case MAGE:
			return new boolean[]{false,false,true,false};
		case PALADIN:
			return new boolean[]{true,false,true,true};
		case PRIEST:
			return new boolean[]{false,false,true,false};
		case ROGUE:
			return new boolean[]{true,false,false,false};
		case SHAMAN:
			return new boolean[]{true,false,true,false};
		case WARLOCK:
			return new boolean[]{false,false,true,false};
		case WARRIOR:
			return new boolean[]{true,false,false,true};
		}
		return new boolean[]{false,false,false,false};
	}
}
